﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CashFlow.Entities
{
	public class RecurrenceOnce : RecurrenceBase
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="T:RecurrenceOnce"/> class.
		/// </summary>
		public RecurrenceOnce() : base()
		{
			Name = "Once";
		}
		protected override void CalcLastDate()
		{
			LastDate = firstDate;
		}

		protected override void CalcRepeats()
		{
			repeats = 1;
		}

		public override DateTime? GetNextDate(DateTime date)
		{
			DateTime? result = null;

			return result;
		}

		//TODO: vvs p2 obsolete: new method name is GetDates
		public override IEnumerable<DateTime> GetNextDates(DateRange range)
		{
			List<DateTime> result = new List<DateTime>();
			if (range.Contains(firstDate))
			{
				result.Add(firstDate);
			}
			return result;
		}

		public override IEnumerable<DateTime> GetDates(DateRange dates)
		{
			List<DateTime> result = new List<DateTime>();
			if (dates.Contains(firstDate))
			{
				result.Add(firstDate);
			}
			return result;
		}
	}
}
